<?php Yii::app()->clientScript->registerScriptFile('/js/admin/admin.js', CClientScript::POS_HEAD); ?>
<div class="content">
<ul class="breadcrumb">
  <li><?php echo CHtml::link('Админка ', array('default/index')); ?> <span class="divider">/</span></li>
       <li><?php echo CHtml::link(' Категории партнерки ', array('default/partnerCat'));?> <span class="divider">/</span></li>
        <?php if(isset($_GET['id'])) : ?>
            <li class="active">Изменить</li>
        <?php else : ?>
            <li class="active">Добавить</li>
        <?php endif; ?>    
    </ul>
     <?php if(isset($_GET['id'])) : ?>
            <h2>Редактирование категории</h2>
        <?php else : ?>
            <h2>Создание категории</h2>
        <?php endif; ?>
    <hr/>
    
    <?php echo CHtml::errorSummary($model); ?>
    
    <?php echo CHtml::form(); ?>
    
    <?php echo CHtml::activeLabel($model, 'name', array('class'=>'text-info')); ?>
    <?php echo CHtml::activeTextField($model, 'name', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('name'))); ?>
    <?php echo CHtml::activeLabel($model, 'about', array('class'=>'text-info','id'=>'cat_description')); ?>
    <?php echo CHtml::activeTextArea($model, 'about', array('class'=>'activeTextArea', 'placeholder'=>$model->getAttributeLabel('about'))); ?>
    <span class="help-block "><small><a class="btn btn-mini" href="javascript:void(0);" onclick="insertReadmore();return false;" >Подробнее...</a></small></span>
    <?php echo CHtml::activeLabel($model, 'parentId',  array('class'=>'text-info')); ?> 
    
  
    
    <?php echo CHtml::activeDropDownList($model, 'parentId', CMap::mergeArray($cats, array('0'=>'----------------------')), array('class'=>'cats')); ?>
    <fieldset>
    <legend>SEO параметры</legend>    
        <div class="controls controls-row">
                <div class="span5"> 
                <?php echo CHtml::activeLabel($model, 'title', array('class'=>'text-info ')); ?>
                <?php echo CHtml::activeTextField($model, 'title', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('title'))); ?>
                </div>   
                <div class="span5">
                <?php echo CHtml::activeLabel($model, 'keywords', array('class'=>'text-info')); ?>
                <?php echo CHtml::activeTextField($model, 'keywords', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('keywords'))); ?> 
                </div>    
        </div> 
    <hr/>
    </fieldset>
    <fieldset>
    <legend>Параметры партнерских программ</legend>    
    <div class="controls controls-row">
    <div class="span5">     
    Параметры 1 сорта: <img src="/images/admin/plus_orange.png" onclick="addParamFields(1);return false;"  style="cursor: pointer"/><br/>
    
    <div class="listSortParams">
    <?php  if(isset($_GET['id'])) {  ?> 
    <?php foreach($sortData as $key => $item) { if($item['type']==1) { ?>
        <div id="paramContainer"><label class="text-info " for="PartnerCat[inputTitle][id<?php echo($item->catRatingId); ?>][]">Значение</label>
        <input class="partner_param activeTextField" type="text" name="PartnerCat[inputTitle][id<?php echo($item->catRatingId); ?>][]" value="<?php echo $item['val'] ?>"  />
        <input type="hidden" class="activeTextField" name="PartnerCat[radioBut][id<?php echo($item->catRatingId); ?>][]" value="<?php echo $item['type'] ?>" />
        <img src="/images/admin/deletered.png" class="delSortParam" style="cursor:pointer"/>
        </div>
        <?php    }}} ?>
    </div>
    </div>
      <div class="span5">     
    Параметры 2 сорта: <img src="/images/admin/plus_orange.png" onclick="addParamFields(2);return false;" style="cursor: pointer"/><br/>
    <div class="listSortParams2">
        <?php  if(isset($_GET['id'])) {  ?> 
        <?php foreach($sortData as $key => $item) { if($item['type']==2) { ?>
        <div id="paramContainer<?php echo $key ?>"><label class="text-info " for="PartnerCat[inputTitle][id<?php echo($item->catRatingId); ?>][]">Значение</label>
        <input class="partner_param activeTextField" type="text" name="PartnerCat[inputTitle][id<?php echo($item->catRatingId); ?>][]" value="<?php echo $item['val'] ?>"  />
        <input type="hidden" class="activeTextField" name="PartnerCat[radioBut][id<?php echo($item->catRatingId); ?>][]" value="<?php echo $item['type'] ?>" />
        <img src="/images/admin/deletered.png" class="delSortParam" style="cursor:pointer"/>
        </div>
        <?php    }} }?>
    </div>
    </div>
    </div>
    <hr/>
    </fieldset>
    <div id="reviewOptions">
    <fieldset>
    <legend>Параметры, по которым будут оцениваться партнерки из этой категории</legend> 
    <div class="controls controls-row">
         <div class="span5"> 
        <?php echo CHtml::activeLabel($model, 'reviewRating1', array('class'=>'text-info ')); ?>
        <?php echo CHtml::activeTextField($model, 'reviewRating1', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('reviewRating1'))); ?> <br/>
        <?php echo CHtml::activeLabel($model, 'revRat1About', array('class'=>'text-info ')); ?>
        <?php echo CHtml::activeTextField($model, 'revRat1About', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('reviewRating1'))); ?> <br/>
        
         </div>
        <div class="span5"> 
        <?php echo CHtml::activeLabel($model, 'reviewRating3', array('class'=>'text-info ')); ?>
        <?php echo CHtml::activeTextField($model, 'reviewRating3', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('reviewRating3'))); ?> <br/>
        <?php echo CHtml::activeLabel($model, 'revRat3About', array('class'=>'text-info ')); ?>
        <?php echo CHtml::activeTextField($model, 'revRat3About', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('reviewRating1'))); ?> <br/>
        
        </div>
     </div>
    <div class="controls controls-row">
        <div class="span5"> 
        <?php echo CHtml::activeLabel($model, 'reviewRating2', array('class'=>'text-info ')); ?>
        <?php echo CHtml::activeTextField($model, 'reviewRating2', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('reviewRating2'))); ?> <br/>
        <?php echo CHtml::activeLabel($model, 'revRat2About', array('class'=>'text-info ')); ?>
        <?php echo CHtml::activeTextField($model, 'revRat2About', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('reviewRating1'))); ?> <br/>
        
        </div>
        <div class="span5"> 
        <?php echo CHtml::activeLabel($model, 'reviewRating4', array('class'=>'text-info ')); ?>
        <?php echo CHtml::activeTextField($model, 'reviewRating4', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('reviewRating4'))); ?> <br/>
        <?php echo CHtml::activeLabel($model, 'revRat4About', array('class'=>'text-info ')); ?>
        <?php echo CHtml::activeTextField($model, 'revRat4About', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('reviewRating1'))); ?> <br/>
        
        </div> 
    </div>
    <div class="controls">
    <?php echo CHtml::activeLabel($model, 'ratingRules', array('class'=>'text-info ')); ?>
    <?php echo CHtml::activeTextArea($model, 'ratingRules', array('class'=>'activeTextArea', 'placeholder'=>$model->getAttributeLabel('ratingRules'))); ?>
    </div>
    <div id="reviewOptions">
    <div><strong>Дополнительные параметры оценки партнерских программ:</strong> <img src="/images/admin/plus_orange.png" class="addCommentRatings" style="cursor: pointer"/></div>
    <div class="aditionalCommentRatings">
    <?php  if(isset($_GET['id'])) {  ?> 
      <?php foreach($commentRatings as $key => $item) {  ?>
        <div><label class="text-info " for="PartnerCat_title<?php echo $key ?>">Значение</label>
        <input id="PartnerCat_title<?php echo $key ?>" class="rating_dop_param activeTextField" type="text" name="PartnerCat[reviewRatingAd][val][]" value="<?php echo $item['val'] ?>"  />
        <img src="/images/admin/deletered.png" class="delCommentRatings" style="cursor:pointer"/>
        <input class="activeTextField" type="text" name="PartnerCat[reviewRatingAd][about][]" value="<?php echo $item['about'] ?>" />
        
        </div>
        <?php    } } ?>   
    </div>
    </div>
    <hr/>
    </fieldset>
    </div>
     <fieldset>
    <legend>Коэффициенты редакторской оценки</legend>    
        <div class="controls controls-row">
                <div class="span3"> 
                <?php echo CHtml::activeLabel($model, 'redactor1', array('class'=>'text-info ')); ?>
                <?php echo CHtml::activeTextField($model, 'redactor1', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('pedactor1'))); ?> 
                </div>   
                <div class="span3">
                <?php echo CHtml::activeLabel($model, 'redactor2', array('class'=>'text-info ')); ?>
    <?php echo CHtml::activeTextField($model, 'redactor2', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('pedactor2'))); ?> 
                </div>    
              <div class="span3">
                <?php echo CHtml::activeLabel($model, 'redactor3', array('class'=>'text-info ')); ?>
    <?php echo CHtml::activeTextField($model, 'redactor3', array('class'=>'activeTextField', 'placeholder'=>$model->getAttributeLabel('pedactor3'))); ?> 
                </div>    
        </div> 
    <hr/>
    </fieldset>
    
    
    
   
    <?php echo CHtml::activeLabel($model, 'reviewRules'); ?>
    <?php echo CHtml::activeTextArea($model, 'reviewRules', array('class'=>'activeTextArea', 'placeholder'=>$model->getAttributeLabel('reviewRules'))); ?>
        
       
    
    
    
    
    
    <br/><br/><br/><?php echo CHtml::submitButton('Подтвердить', array('class'=>'btn btn-large btn-primary')); ?>
    <?php echo CHtml::endForm(); ?> 
</div>
    
